/*
 * Create Author  : jinpeng.chen
 * Create Date    : 2016-12-05
 * Project        : spring-boot
 * File Name      : SpringBootChapter5Application.java
 *
 * Copyright (c) 2010-2015 by Shanghai HanTao Information Co., Ltd.
 * All rights reserved.
 *
 */
package com.charles.chapter5;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能描述:  <p>
 *
 * @author : jinpeng.chen <p>
 * @version 1.0 2016-12-05
 * @since spring-boot 1.0
 */
@SpringBootApplication
@RestController
public class SpringBootChapter5Application {
    @Autowired
    private Book book;

    @RequestMapping("/")
    public String index() {
        return "book author is: " + book.getAuthor() + ", book name is: " + book.getName();
    }

    public static void main(String[] args) {
        //第一种启动方式
        //SpringApplication.run(SpringBootChapter5Application.class, args);

        //第二种启动方式
        /*SpringApplication application = new SpringApplication(SpringBootChapter5Application.class);
        application.setBannerMode(Banner.Mode.OFF);//关闭banner
        application.run(args);*/
        //第三种启动方式
        new SpringApplicationBuilder(SpringBootChapter5Application.class).run(args);
    }
}
